﻿using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace Kxzz.Controls
{
   public class MyPicture : PictureBox
    {
        private Container components;
        public bool IsSent;
        public int pos;

        public MyPicture()
        {
            this.components = null;
            this.IsSent = false;
            this.pos = 0;
            this.InitializeComponent();
        }

        public MyPicture(uint ID)
        {
            this.components = null;
            this.IsSent = false;
            this.pos = 0;
            this.InitializeComponent();
            base.Tag = ID;
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            this.components = new Container();
        }

        private void OnFrameChanged(object sender, EventArgs e)
        {
            base.Invalidate();
        }

        public void playGif()
        {
            ImageAnimator.Animate(base.Image, new EventHandler(this.OnFrameChanged));
        }
    }
}

